const allowOrigin = ['http://localhost:8080','http://localhost:3000','http://localhost:9527','http://10.51.170.158:8080','http://10.51.170.158:9527'];
module.exports = (req,res,next)=>{
   
    if(req.method === "OPTIONS"){
      
        res.header("Access-Control-Allow-Methods",req.headers["access-control-request-method"]);
        res.header("Access-Control-Allow-Headers",req.headers["access-control-request-headers"]);
        res.header("Access-Control-Max-Age","3600");
    }
    if('origin' in req.headers && allowOrigin.includes(req.headers.origin)){
        res.header("access-control-allow-origin",req.headers.origin);
        res.header('Access-Control-Allow-Creadential',true);
    }
   
    next();
}